﻿@using Weibo.Common.Pager
@model Weibo.Web.Models.ClassPhotoModel
@{
    var border = "";

    ViewData["curBorder"] = border;
    Group g = null;

    if (Model.gid != null)
    {
        g = Groups.GetGroupByID(Convert.ToInt64(Model.gid));
    }
    Education gg = null;
    IList<Education> allGroups = Model.EducationList;
    IList<Education> barGroups = null;
    IList<Education> popListGroups = null;
}
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    ViewBag.Title = "111222我的首页 XX微博-随时随地分享身边的新鲜事儿";
}
@section  cssInsert{
    <link rel="stylesheet" type="text/css" href="/Content/CSS/miniblog/index.css" />
    <link rel="stylesheet" type="text/css" href="@Model.CurSkinCss" />
    <link rel="stylesheet" type="text/css" href="/Content/CSS/miniblog/layer.css" />
    <link href="../../Content/CSS/jquery.ad-gallery.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/ClassPhoto/css/jquery_dialog.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/CSS/pager.css" rel="stylesheet" type="text/css" />
}
@section  jsInsert{
    <script type="text/javascript">
        curBorder = "@border";
    </script>
    <script src="../../Scripts/jquery.ad-gallery.js" type="text/javascript" charset="gb2312"></script>
    <script src="../../Content/ClassPhoto/js/jquery_dialog.js" type="text/javascript"></script>
    <script src="../../Scripts/classPhoto.js" type="text/javascript"></script>
}
<script type="text/javascript">
     $(function () {
         $('img.image1').data('ad-desc', 'Whoa! This description is set through elm.data("ad-desc") instead of using the longdesc attribute.<br>And it contains <strong>H</strong>ow <strong>T</strong>o <strong>M</strong>eet <strong>L</strong>adies... <em>What?</em> That aint what HTML stands for? Man...');
         $('img.image1').data('ad-title', 'Title through $.data');
         $('img.image4').data('ad-desc', 'This image is wider than the wrapper, so it has been scaled down');
         $('img.image5').data('ad-desc', 'This image is higher than the wrapper, so it has been scaled down');
         var galleries = $('.ad-gallery').adGallery();
         $('#switch-effect').change(
      function () {
          galleries[0].settings.effect = $(this).val();
          return false;
      }
    );
         $('#toggle-slideshow').click(
      function () {
          galleries[0].slideshow.toggle();
          return false;
      }
    );
         $('#toggle-description').click(
      function () {
          if (!galleries[0].settings.description_wrapper) {
              galleries[0].settings.description_wrapper = $('#descriptions');
          } else {
              galleries[0].settings.description_wrapper = false;
          }
          return false;
      }
    );
         $("#gallery").hide();   //默认将图片幻灯片隐藏
      App.hideMoreClass();
      var gid = App.getUrlValue("gid");
      $("li[gid='" + gid + "']").attr("class", "current");
      var classPhotoID = App.getUrlValue("classPhotoID");
      if (classPhotoID>0) {
           $("#photoContainer").hide();
           $("#photo_class_mode").show();
           $("#albumWrap").show();
      }
      $(".close").click(function() {
          $("#CreateNewBox").hide(); 
          App.hideMash();
      }); 
         
  });
 
     function MemberShow(obj) {
       var uid = @Model.uid ;
       var gid = App.getUrlValue("gid");
      var action = $(obj).attr("action");
         if (action=="all") {
             window.location.href = "/" + uid + "/School#!/" + uid + "/School?gid=" + gid; 
         }
         else {
              window.location.href = "/" + uid + "/School#!/" + uid + "/School?" + action + "=1&gid=" + gid;
         }
     
  }
      function refreshFun()
 {
     var url = window.location.href.replace("#","");
     window.location.href =url ;
 }
     function CreateNewClassPhoto(obj) {
          var gid=App.getUrlValue("gid");
               JqueryDialog.Open('创建相册', '/@Model.CurUser.ID/NewWindow/createNewphoto?t=' + Math.random()+ "&gid=" + gid, 300,80);
 }
       function uploadOpen(obj) {
         var classPhotoID=App.getUrlValue("classPhotoID");
       var gid=App.getUrlValue("gid");
      JqueryDialog.Open('文件窗口', '/@Model.CurUser.ID/School/FileCom?t=' + Math.random() + '&classPhotoID=' + classPhotoID + "&gid=" + gid, 700, 400);
  }
</script>
@section  conSupplement{
    <div class="nfTaglay" style="z-index: 99; position: absolute; display: none;">
        <ul class="sltmenu_m">
            @{
                if (popListGroups != null)
                {
                    for (int i = 0; i < popListGroups.Count; i++)
                    {
                <li pop="1"  gid="@popListGroups[i].ID" class="txt"><a href="@("#!" + Utils.AddQueryToUrl(Request.Url.AbsolutePath, "gid", popListGroups[i].ID.ToString()))" title="@CommonMethod.DealSchoolName(popListGroups[i])">@popListGroups[i].SchoolClassName</a></li>
                    }
                }
            }
            @* <li class="MIB_linedot2"></li>*@ @*    <li><a id="Adjust_group_order" href="javaScript:void(0);">
                <img title="调整分组顺序" class="iconord" src="/Content/Image/transparent.gif">调整分组顺序111</a></li>*@
        </ul>
    </div>
    <script src="../../Scripts/js/classPhoto.js" type="text/javascript"></script>
}
<div class="MIB_blogbody">
    <div class="MIB_mblogbgr @border">
        <div class="MIB_mblogbgl">
            <div class="mainR MIB_200 MIB_txtar MIB_linkar">
                @RenderPage("~/Views/Shared/_userInfo.cshtml")
                @RenderPage("~/Views/Shared/_rightNav.cshtml")
                @RenderPage("~/Views/Shared/Wedget_HotTopic.cshtml")
                @RenderPage("~/Views/Shared/Wedget_MyFan.cshtml")
                @RenderPage("~/Views/Shared/Wedget_MyFollow.cshtml")
            </div>
            <div id="indexMainL" class="mainL MIB_600 MIB_txtal MIB_linkal">
                <div class="MIB_mbloglist">
                    <div id="MIB_newFilter" class="newFilter MIB_txtal" style="padding-top: 12px;">
                        <div class="nfTagB nfTagOn">
                            <ul id="ulClassList">
                                @{
                                              
                                    <li isall="1"><a onclick="MemberShow(this)" href="/@Model.uid/School">我的班级</a></li><li
                                        class="MIB_line_l">|</li>

                                    if (allGroups != null && allGroups.Count > 3)
                                    {
                                        barGroups = new List<Education>();
                                        popListGroups = new List<Education>();
                                        for (int i = 0; i < allGroups.Count; i++)
                                        {
                                            if (gg != null && allGroups[i].ID == gg.ID && i >= 3)
                                            {

                                                Education tmp = barGroups[2];

                                                barGroups[2] = gg;

                                                popListGroups.Insert(0, tmp);
                                            }

                                            else
                                            {

                                                if (i < 3)
                                                {

                                                    barGroups.Add(allGroups[i]);

                                                }

                                                else
                                                {

                                                    popListGroups.Add(allGroups[i]);

                                                }

                                            }
                                        }
                                    }
                                    else if (allGroups != null && allGroups.Count <= 3)
                                    {
                                        barGroups = new List<Education>();
                                        for (int i = 0; i < allGroups.Count; i++)
                                        {
                                            barGroups.Add(allGroups[i]);
                                        }
                                    }
                                    if (barGroups != null)
                                    {
                                        for (int i = 0; i < barGroups.Count; i++)
                                        {
                                            if (Weibo.Common.Utils.CurrentClass(Request.Url.ToString(), "gid", barGroups[i].SchoolClassID.ToString()) == "current")
                                            {												
                                    <li  gid="@barGroups[i].SchoolClassID" class="current"  ><span title="@CommonMethod.DealSchoolName(barGroups[i])" href="@(Utils.AddQueryToUrl("/" + Model.uid.ToString() + "/School" + "#!" + Request.UrlReferrer, "gid", barGroups[i].SchoolClassID.ToString()))"  onclick="MemberShow(this)">@barGroups[i].SchoolClassName</span></li>
                                    <li class="MIB_line_l">|</li>
                                            }
                                            else
                                            {

                                    <li  gid="@barGroups[i].SchoolClassID" class="" ><a title="@CommonMethod.DealSchoolName(barGroups[i])" href="@(Utils.AddQueryToUrl("/" + Model.uid.ToString() + "/School" + "#!" + Request.UrlReferrer, "gid", barGroups[i].SchoolClassID.ToString()))"  onclick="MemberShow(this)">@barGroups[i].SchoolClassName</a></li>
                                    <li class="MIB_line_l">|</li>
                                               

                                            }
                                        }
                                    }
                                    
                                    <li tip="1"><a href="#" class="moreti"><span class="txt">更多</span><span class="more"></span></a>
                                    </li>
                                     
                                }
                            </ul>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="nfBox">
                            <div id="filter_key_panel" class="nfBoxSim" style="display: @(Model.IsAdvanced > 0 ? "none" : "block");">
                                <div class="left">
                                    <a title="首页" action="all" href="#" onclick="MemberShow(this)">首页</a> <a class="current"
                                        title="图片" action="IsHavePic" href="#">相册</a> <a title="视频" action="IsHaveVideo"
                                            href="#" onclick="MemberShow(this)">视频</a> <a title="音乐" action="IsHaveMusic" href="#"
                                                onclick="MemberShow(this)">音乐</a> <a title="投票" action="IsHaveVote" href="#" onclick="MemberShow(this)">
                                                    投票</a> <a title="成员" action="IsHaveMember" href="#" onclick="MemberShow(this)">成员</a>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="photo_class_mode noVisible" id="photo_class_mode">
                    <div rel="http://www.pengyou.com/index.php?mod=classalbum&amp;class_id=1499689194"
                        id="albumHeader" class="upload_photo">
                        <a href="@Utils.RemoveQueryFromUrlnoPage(ViewData["URL"].ToString(), "classPhotoID")"  >
                            &lt;&lt; 返回相册列表</a>&nbsp;<div class="fun_wrap">
                                @*     <a onclick="shareToFriend();return false;" href="#">复制相册地址</a><span class="c_tx2">&nbsp;
                                    | &nbsp;</span>*@ <a onclick="uploadOpen(this)" href="#">上传我的照片</a>
                            </div>
                    </div>
                    <div id="albumWrap" class="noVisible">
                        <div class="list_photo_wrap clearfix">
                            <ul id="albumList" class="list_photo clearfix">
                                @if (Model.ClassPhotoDetailsList != null && Model.RecordCount > 0)
                                {
                                    foreach (var photoDetail in Model.ClassPhotoDetailsList)
                                    {
                                      
                                    <li class=""><a class="pic_bg" onclick="hotoDetails(this)" href="#">
                                        <img width="100" height="75" alt="" src="@(BaseConfigs.GetWebDomain + photoDetail.ImagePath)" onload="App.DrawImage(this,100,75);" alt="班级相册" photoID="@photoDetail.ID"></a>
                                        <div class="info_pic_wrap">
                                            <a class="emlink" href="#">看空间福德</a>
                                            @if (Model.CurUser.ID == Model.ClassPhotoList.Where(para => para.ID == photoDetail.classPhotoID).First().CreateUserID)
                                            {
                                                <div class="list_photo_close">
                                                    <a href="#" onclick="App.delPhoto(this)">X</a>
                                                </div>
                                            }
                                        </div>
                                    </li>
                                        

                                    }

                                }
                            </ul>
                        </div>
                    </div>
                    <div class="com_photo_wrap" id="photoComment">
                    </div>
                    <div class="page noVisible" style="display: block;" id="page">
                        @Html.BdyPager(Model.PageSize, Model.RecordCount)
                    </div>
                </div>
                @if (Model.ClassPhotoList == null || Model.ClassPhotoList.Count < 1)
                {
                    <div class="NoPhoto" id="NoPhoto">
                        <p>
                            暂时没有班级相册。</p>
                        <br />
                        @* <a href="#" onclick="uploadOpen(this)">直接上传</a> *@<a href="#" onclick="CreateNewClassPhoto(this)">
                            新建班级相册</a>
                    </div>
                }
                else
                {
                    <div class="divcontainer" id="photoContainer">
                        <div class="newClassPhoto">
                            <a href="#" onclick="CreateNewClassPhoto(this)">新建班级相册</a></div>
                        <ul class="album-list">
                            @foreach (var classPhoto in Model.ClassPhotoList)
                            {
                                <li>
                                    <div class="img-box">
                                        <div class="img-container">
                                            <b class="ie-center"></b><a href="#" style="text-decoration: none; text-align: center;" classPhotoID="@classPhoto.ID"  onclick="PhotoClick(this)">
                                                <img   src="@classPhoto.DefaultPhotoPath"   alt="班级相册"  /></a>
                                        </div>
                                    </div>
                                    <h4>
                                        <a href="">@classPhoto.PhotoName</a></h4>
                                    <p class="meta">
                                        <span class="weak">共 @classPhoto.PhotoCount 张</span></p>
                                </li>
                            }
                        </ul>
                    </div>
                }
                <div id="gallery" class="divcontainer ad-gallery">
                    <div class="ad-image-wrapper">
                    </div>
                    <div class="ad-controls">
                    </div>
                    <div class="ad-nav">
                        <div class="ad-thumbs">
                            <ul class="ad-thumb-list">
                                @if (Model.ClassPhotoDetailsList != null && Model.ClassPhotoList[0].PhotoCount > 0)
                                {

                                    foreach (var photoDetail in Model.ClassPhotoDetailsList)
                                    {
                                       
                                    <li><a href="@photoDetail.ImagePath">
                                        <img src="@photoDetail.ImagePath" alt="班级相册" style="opacity: 0.7; width:120px;height:60px;" @*title=" this is title" alt="this is alt" longdesc="this is longdesc"*@ />
                                    </a></li>
                                        
                                    }
                                }
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
